package com.cafe.pro.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.cafe.pro.aop.EncryptedField;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
@TableName("user") // 对应数据库表名
public class User {
    @TableId(type = IdType.AUTO) // 主键自增
    private Long id;
    private String name;
    private Integer age;
    private String email;
    private String keyVersion;
    private String encryptedPhone;
    private String encryptedIdCard;

    @TableField(exist = false)
    @EncryptedField("encryptedPhone")
    private String phone;

    @TableField(exist = false)
    @EncryptedField("encryptedIdCard")
    private String idCard;
}